package com.ailanyin.modules.flowable.service.impl;

import cn.hutool.core.lang.UUID;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ailanyin.common.base.domain.Query;
import com.ailanyin.modules.flowable.mapper.WfCategoryMapper;
import com.ailanyin.modules.flowable.domain.WfCategory;
import com.ailanyin.modules.flowable.service.IWfCategoryService;

/**
 * 流程分类Service业务层处理
 *
 * @author ailanyin
 * @date 2022-12-09
 */
@Service
public class WfCategoryServiceImpl implements IWfCategoryService {

    @Resource
    private WfCategoryMapper wfCategoryMapper;

    /**
     * 查询流程分类
     *
     * @param categoryId 流程分类主键
     * @return 流程分类
     */
    @Override
    public WfCategory selectByCategoryId(Long categoryId) {
        return wfCategoryMapper.selectByCategoryId(categoryId);
    }

    /**
     * 查询流程分类列表
     *
     * @param wfCategory 流程分类
     * @return 流程分类
     */
    @Override
    public List<WfCategory> selectList(WfCategory wfCategory) {
        return wfCategoryMapper.selectList(wfCategory);
    }

    /**
     * 新增流程分类
     *
     * @param wfCategory 流程分类
     * @return 结果
     */
    @Override
    public int insert(WfCategory wfCategory) {
        wfCategory.setUuid(UUID.fastUUID().toString(true));
        return wfCategoryMapper.insert(wfCategory);
    }

    /**
     * 批量新增流程分类
     *
     * @param list list 流程分类集合
     * @return 结果
     */
    @Override
    public int insertBatch(List<WfCategory> list) {
        return wfCategoryMapper.insertBatch(list);
    }

    /**
     * 修改流程分类
     *
     * @param wfCategory 流程分类
     * @return 结果
     */
    @Override
    public int update(WfCategory wfCategory)
    {
        return wfCategoryMapper.updateByCategoryId(wfCategory);
    }

    /**
     * 批量删除流程分类
     *
     * @param query id,uuid
     * @return 结果
     */
    @Override
    public int deleteBatch(List<Query<Long>> query)
    {
        wfCategoryMapper.deleteBatch(query);
        return 1;
    }


}
